<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>justify-content</title>
    <style>
      .flex-container {
        display: -webkit-flex;
        display: flex;
        width: auto;
        height: 150px;
        background-color: lightgrey;
      }

      .flex-item {
        background-color: cornflowerblue;
        width: 100px;
        height: 100px;
        line-height: 100px;
        margin: 10px;
        text-align: center;
      }
    </style>
  </head>

  <body>
    <h1>
      内容对齐（justify-content）属性应用在弹性容器上，把弹性项沿着弹性容器的主轴线（main
      axis）对齐。
    </h1>

    <h2>
      justify-content: flex-start
      弹性项目向行头紧挨着填充。这个是默认值。第一个弹性项的main-start外边距边线被放置在该行的main-start边线，而后续弹性项依次平齐摆放。
    </h2>
    <div class="flex-container" style="justify-content: flex-start">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      justify-content: flex-end
      弹性项目向行尾紧挨着填充。第一个弹性项的main-end外边距边线被放置在该行的main-end边线，而后续弹性项依次平齐摆放。
    </h2>
    <div class="flex-container" style="justify-content: flex-end">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      justify-content: center
      弹性项目居中紧挨着填充。（如果剩余的自由空间是负的，则弹性项目将在两个方向上同时溢出）。
    </h2>
    <div class="flex-container" style="justify-content: center">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      justify-content: space-between
      弹性项目平均分布在该行上。如果剩余空间为负或者只有一个弹性项，则该值等同于flex-start。否则，第1个弹性项的外边距和行的main-start边线对齐，而最后1个弹性项的外边距和行的main-end边线对齐，然后剩余的弹性项分布在该行上，相邻项目的间隔相等。
    </h2>
    <div class="flex-container" style="justify-content: space-between">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      justify-content: space-around
      弹性项目平均分布在该行上，两边留有一半的间隔空间。如果剩余空间为负或者只有一个弹性项，则该值等同于center。否则，弹性项目沿该行分布，且彼此间隔相等（比如是20px），同时首尾两边和弹性容器之间留有一半的间隔（1/2*20px=10px）。
    </h2>
    <div class="flex-container" style="justify-content: space-around">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>

    <h2>
      justify-content: space-evenly 均匀排列每个元素,每个元素之间的间隔相等
    </h2>
    <div class="flex-container" style="justify-content: space-evenly">
      <div class="flex-item">flex item 1</div>
      <div class="flex-item">flex item 2</div>
      <div class="flex-item">flex item 3</div>
    </div>
  </body>
</html>
